import request from "@/utils/request";
import type { allSkuInfoDetailType, skuInfoItemDetailType, skuInfoListType } from "@/types/sku";

// sku上架
export const reqOnSale = (skuId: number) => {
    return request.get<null, null>(`/admin/product/onSale/${skuId}`);
};
// sku下架
export const reqCancelSale = (skuId: number) => {
    return request.get<null, null>(`/admin/product/cancelSale/${skuId}`);
};
// 删除某个sku
export const reqDeleteSku = (skuId: number) => {
    return request.delete(`/admin/product/deleteSku/${skuId}`);
};
// 根据某个spuId查询他的所有sku列表(但是sku的信息不是详细的)
export const reqSkuList = (spuId: number) => {
    return request.get<null, skuInfoListType>(`/admin/product/findBySpuId/${spuId}`);
};
// 根据skuId查询他的详细信息
export const reqSkuInfo = (skuId: number) => {
    return request.get<null, skuInfoItemDetailType>(`/admin/product/getSkuById/${skuId}`);
};
// 查询所有的sku列表
export const reqAllSkuList = (page: number, limit: number) => {
    return request.get<null, allSkuInfoDetailType>(`/admin/product/list/${page}/${limit}`);
};
// 添加sku
export const reqAddSku = (skuInfo: skuInfoItemDetailType) => {
    return request.post<null, null>("/admin/product/saveSkuInfo", skuInfo);
};
